{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from __future__ import print_function\n",
    "%matplotlib inline "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Sliders Example \n",
    "\n",
    "This is an example of interactive iPython workbook that uses widgets to meaningfully interact with visualization. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Imports \n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from collections import OrderedDict\n",
    "from sklearn.pipeline import Pipeline\n",
    "from sklearn.preprocessing import Imputer \n",
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.metrics import mean_squared_error as mse\n",
    "from ipywidgets import interact, interactive, fixed\n",
    "\n",
    "import ipywidgets as widgets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Data Loading \n",
    "columns = OrderedDict([\n",
    "    (\"DAY\", \"the day of data collection\"),\n",
    "    (\"Q-E\", \"input flow to plant\"),\n",
    "    (\"ZN-E\", \"input Zinc to plant\"),\n",
    "    (\"PH-E\", \"input pH to plant\"),\n",
    "    (\"DBO-E\", \"input Biological demand of oxygen to plant\"),\n",
    "    (\"DQO-E\", \"input chemical demand of oxygen to plant\"),\n",
    "    (\"SS-E\", \"input suspended solids to plant\"),\n",
    "    (\"SSV-E\", \"input volatile supended solids to plant\"),\n",
    "    (\"SED-E\", \"input sediments to plant\"),\n",
    "    (\"COND-E\", \"input conductivity to plant\"),\n",
    "    (\"PH-P\", \"input pH to primary settler\"),\n",
    "    (\"DBO-P\", \"input Biological demand of oxygen to primary settler\"),\n",
    "    (\"SS-P\", \"input suspended solids to primary settler\"),\n",
    "    (\"SSV-P\", \"input volatile supended solids to primary settler\"),\n",
    "    (\"SED-P\", \"input sediments to primary settler\"),\n",
    "    (\"COND-P\", \"input conductivity to primary settler\"),\n",
    "    (\"PH-D\", \"input pH to secondary settler\"),\n",
    "    (\"DBO-D\", \"input Biological demand of oxygen to secondary settler\"),\n",
    "    (\"DQO-D\", \"input chemical demand of oxygen to secondary settler\"),\n",
    "    (\"SS-D\", \"input suspended solids to secondary settler\"),\n",
    "    (\"SSV-D\", \"input volatile supended solids to secondary settler\"),\n",
    "    (\"SED-D\", \"input sediments to secondary settler\"),\n",
    "    (\"COND-S\", \"input conductivity to secondary settler\"),\n",
    "    (\"PH-S\", \"output pH\"),\n",
    "    (\"DBO-S\", \"output Biological demand of oxygen\"),\n",
    "    (\"DQO-S\", \"output chemical demand of oxygen\"),\n",
    "    (\"SS-S\", \"output suspended solids\"),\n",
    "    (\"SSV-S\", \"output volatile supended solids\"),\n",
    "    (\"SED-S\", \"output sediments\"),\n",
    "    (\"COND-\", \"output conductivity\"),\n",
    "    (\"RD-DB-P\", \"performance input Biological demand of oxygen in primary settler\"),\n",
    "    (\"RD-SSP\", \"performance input suspended solids to primary settler\"),\n",
    "    (\"RD-SE-P\", \"performance input sediments to primary settler\"),\n",
    "    (\"RD-DB-S\", \"performance input Biological demand of oxygen to secondary settler\"),\n",
    "    (\"RD-DQ-S\", \"performance input chemical demand of oxygen to secondary settler\"),\n",
    "    (\"RD-DB-G\", \"global performance input Biological demand of oxygen\"),\n",
    "    (\"RD-DQ-G\", \"global performance input chemical demand of oxygen\"),\n",
    "    (\"RD-SSG\", \"global performance input suspended solids\"),\n",
    "    (\"RD-SED-G\", \"global performance input sediments\"),\n",
    "])\n",
    "\n",
    "data = pd.read_csv(\"data/water-treatment.data\", names=columns.keys())\n",
    "data = data.replace('?', np.nan)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# Capture only the numeric columns in the data set. \n",
    "numeric_columns = columns.keys()\n",
    "numeric_columns.remove(\"DAY\")\n",
    "data = data[numeric_columns].apply(pd.to_numeric)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2D Rank Features "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "def apply_column_pairs(func):\n",
    "    \"\"\"\n",
    "    Applies a function to a pair of columns and returns a new \n",
    "    dataframe that contains the result of the function as a matrix\n",
    "    of each pair of columns. \n",
    "    \"\"\"\n",
    "    \n",
    "    def inner(df):\n",
    "        cols = pd.DataFrame([\n",
    "            [\n",
    "                func(df[acol], df[bcol]) for bcol in df.columns\n",
    "            ] for acol in df.columns\n",
    "        ])\n",
    "\n",
    "        cols.columns = df.columns\n",
    "        cols.index = df.columns \n",
    "        return cols\n",
    "\n",
    "    return inner \n",
    "\n",
    "\n",
    "@apply_column_pairs\n",
    "def least_square_error(cola, colb):\n",
    "    \"\"\"\n",
    "    Computes the Root Mean Squared Error of a linear regression \n",
    "    between two columns of data. \n",
    "    \"\"\"\n",
    "    x = cola.fillna(np.nanmean(cola))\n",
    "    y = colb.fillna(np.nanmean(colb))\n",
    "    \n",
    "    m, b = np.polyfit(x, y, 1)\n",
    "    yh  = (x * m) + b \n",
    "    return ((y-yh) ** 2).mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAk8AAAIWCAYAAABORmlRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3Xl8VPX1//H3ZJNlWGSnBVwQRFIFkVIDBFmkWL6AAsZE\nDItQ1LoVQRFFJAEhyGIpIriwyKahAoqGaiyyp+ICBVkUASthMRiBYBJjFub+/uDHlAC5mRsyM3cm\nr2cfeTxm7r1n7rm5l3j6uZ+5x2EYhiEAAAB4JMTfCQAAAAQSiicAAAALKJ4AAAAsoHgCAACwgOIJ\nAADAAoonAAAACyieUCEdPXpUN998s7/TKNHGjRs1a9asS65bt26dJk2a5OOMvOOHH37QsGHDdOed\nd6p3795677333Os+++wz9evXT3fddZfi4uK0e/fuS37G3Llz1aVLFz377LNlyiEnJ0eDBw8uUyyA\niinM3wkA/uJwOPydQol27dqln3/++ZLrunbtqq5du/o4I++YMGGCOnfurIEDB+rEiRP64x//qKio\nKNWvX1+jR4/WtGnT1K5dO61du1ZjxoxRSkrKRZ+xcuVKzZgxQ23atClTDllZWdq1a9flHgqACoTi\nCbjAl19+qRdffFEul0sOh0MPPvigunfvrsLCQk2fPl1ffPGFXC6XbrjhBj333HOqWrVqsfjZs2cr\nPT1d6enpyszM1E033aQOHTrovffe09GjR/XUU0+pZ8+ekqRXX31VH3/8sQzD0G9/+1s9//zzysjI\nUHJyslwul5xOp6666iqtWLFCeXl5qlatmu666y6lpqbq1Vdf1U8//aTx48fru+++U2hoqGJjYzVw\n4MBi+eTl5SkhIUGHDh1SVlaWqlatqhkzZujqq68uMX7gwIGqWbOm/vvf/+ree+/V7bffrvHjx+vo\n0aOSpLvuukvDhg3TmTNnNHHiRG3fvl3h4eFq3LixkpKSFBERccnllStXLpbb3Llzde45vUePHlVY\nWJgqVaokSXI6nTp9+rSks6NDV1xxxUXn6oknnlBGRobGjh2rxx9/XNHR0Zo0aZK+/fZbFRUVKSoq\nSqNHj1ZISIhWrFihf/zjHyoqKlJWVpYeeOABxcXF6dlnn9Wvv/6qvn37auXKlWrZsqW2bt2qmjVr\nSpJatGihrVu36ttvv9WkSZNUuXJl/frrr3rnnXe0efNmvfrqqyoqKlKlSpU0evRotW7dWt99953G\njh2rgoICGYahu+++WwMGDLjcSxOAXRhABXTkyBHj5ptvvuS6wYMHG2vWrDEMwzC++eYbY8KECYZh\nGMbs2bONqVOnurd76aWXjISEhIviX375ZaNbt25GTk6O8euvvxrt2rUzpkyZYhiGYaxdu9b44x//\naBiGYbz77rvGE088Y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2VNWqVXXllVfq9ttv1549e1S5cmU1\na9ZMLVu2lCTdfvvtmjx5sg4ePKjIyMhL/i4k6cyZM/r73/+ua6+9VpKUnZ0th8Oh48ePKzY2VrGx\nsWrbtq169OihjRs3lvg554qhwsLCYnPjzj8PLpdLUVFReumll9zLjh07poYNG+r666/Xxx9/rLS0\nNG3dulWvvPKKkpOT1bhx4xL3CSBw8G07VFgXjjCcExcXp7179+quu+7ShAkTlJ2drZ9//lnR0dFa\ntmyZCgoK5HK59Pzzz+tvf/tbmfffsWNHvfPOO8rJyZEkvfzyyxozZowkKTQ0VIWFhaV+Rvv27bVq\n1SpJZwuFwYMHKz09vdg2aWlp6tevn/r376+rr75a69evdxdEnsRXrVpVrVq10rJly9zbvffee+rQ\noYM2bNigwYMH6+abb9ajjz6qu+66S998802Jyy/09ttvF/vcTz75RFFRUYqMjNTBgwf1/fffS5J2\n7typ/Px8XX311aa/j+joaL355psyDEMFBQV65JFHtGzZMu3atUu1atXSX/7yF3Xo0EHr16+XdPYa\nCAsLK1Yg1q5d2/3Nvo8//rjEfd16661KS0vTd999J0navHmz+vbtq/z8fI0aNUpr1qxRz5499fzz\nz8vpdCojI8M0dwCBg5EnVFi//vqr+xtahmHI4XBo+fLlGj16tF544QX9/e9/l8Ph0KOPPqrf/OY3\nevjhhzV16lT17dtXhmHohhtucN/yKouYmBj9+OOPio2NVUhIiBo2bKikpCRJUlRUlB577DGFh4eb\njrSMGzdOCQkJ6tOnjwzD0EMPPeQerTln6NChev755/Xee++pZs2auv32292jLiXFX/hNxOnTpysx\nMVErV65UUVGR+vTpo759+8rlcmnz5s3q1auXqlSpopo1a2rixIlq0KDBJZdf6MUXX9S4ceOUkpIi\nh8Ohe+65R926dZN09pt4jz/+uBwOhypXrqzZs2dfNDlfKv6tybFjx2ry5Mnq06ePioqK1KFDB/35\nz39WYWGhVq5cqR49eqhOnTrq1q2b6tSpo0OHDqlJkya64YYb1LNnT7399tsaO3asEhMTVb16dXXo\n0EF169a95O/+uu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kwxtTUFNPT05SVlW1I\nLH/KeteCtrY25ubm4q7LVLm5ufT392Oz2Xj48GHSOVxZWZlSnN+/f6ejo4PR0VHy8vLQNA1N0wxd\ni6203qQxkVgBEXt+lpaW6j/zer3k5+fHFRexa0tKSigsLMTlcvHjxw9OnTq1IXGL/21I8lRfX8+l\nS5c4ceIEubm52O12CgoKqK6u5u7du/p1brd7WyYLydTU1OD1emloaGDXrl1EIhFu3LjB4cOHcTgc\nDA0NsXPnTvbu3YvD4Ug4xq9tu2PHjulb1Znqw4cP2Gw2FEVhdXWVq1evoqoq09PTevsqFArR2Nio\nV1SdnZ3Y7XYikQjhcJiampqkOw3/mrXf2+rqKnV1dRl9vmftvM/KyiIajXL9+nXevn2bdD4vLS0Z\nYrRarTQ0NCQc//nz54yNjaEoCqqq4nQ6M/L8z1rrXQtu376d8pqRKYqLi7HZbDx79izlOZwsTk3T\n6OnpobW1lR07dhCJRKiqqsJqtWZUQfW7SSMYi87x8XHMZjMFBQVcvHiR/v5+Hjx4gMfjYXh4mMXF\nRRobG+OKC03TcDgcHDlyRG/dvX//PuP/P/4GpugGZS8ej4d79+7x7ds3QqEQmqaRk5NDb2+v3ht2\nu93Y7XaKi4sB9AX2yZMnGVNhCCGEEDFut5uRkRFDx2RwcBCPx8P4+DilpaWGpPH8+fNxY3R3d+Px\neNizZw+KopCdnU1vby/5+fkAjI2N4XK5UBSFUCiE2WzGarXS3t4eN9bExAQDAwOEw2GWl5exWCy0\ntbUZdq7En7dhyVMiX758oaioCLPZvFm/UgghhNj2Pn36lPHt6n/JpiZPQgghhBDbnTRGhRBCCCHS\nIMmTEEIIIUQaJHkSQgghhEiDJE9CCCGEEGmQ5EkIIYQQIg2SPAkhhBBCpOE/RDTh0boONrgAAAAA\nSUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10b017690>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "labeled_metrics = {\n",
    "    'Pearson': 'pearson', \n",
    "    'Kendall Tao': 'kendall', \n",
    "    'Spearman': 'spearman', \n",
    "    'Pairwise Covariance': 'covariance',\n",
    "    'Least Squares Error': 'lse', \n",
    "}\n",
    "\n",
    "@interact(metric=labeled_metrics, data=fixed(data))\n",
    "def rank2d(data, metric='pearson'):\n",
    "    \"\"\"\n",
    "    Creates a visualization of pairwise ranking by column in the data. \n",
    "    \"\"\"\n",
    "    \n",
    "    # The different rank by 2d metrics. \n",
    "    metrics = {\n",
    "        \"pearson\": lambda df: df.corr('pearson'), \n",
    "        \"kendall\": lambda df: df.corr('kendall'), \n",
    "        \"spearman\": lambda df: df.corr('spearman'), \n",
    "        \"covariance\": lambda df: df.cov(), \n",
    "        \"lse\": least_square_error,\n",
    "    }\n",
    "    \n",
    "    # Quick check to make sure a valid metric is passed in. \n",
    "    if metric not in metrics:\n",
    "        raise ValueError(\n",
    "            \"'{}' not a valid metric, specify one of {}\".format(\n",
    "                metric, \", \".join(metrics.keys())\n",
    "            )\n",
    "        )\n",
    "    \n",
    "    \n",
    "    # Compute the correlation matrix\n",
    "    corr = metrics[metric](data)\n",
    "\n",
    "    # Generate a mask for the upper triangle\n",
    "    mask = np.zeros_like(corr, dtype=np.bool)\n",
    "    mask[np.triu_indices_from(mask)] = True\n",
    "\n",
    "    # Set up the matplotlib figure\n",
    "    f, ax = plt.subplots(figsize=(11, 9))\n",
    "    ax.set_title(\"{} metric across {} features\".format(metric.title(), len(data.columns)))\n",
    "    \n",
    "    # Draw the heatmap with the mask and correct aspect ratio\n",
    "    sns.heatmap(corr, mask=mask, vmax=.3,\n",
    "                square=True, xticklabels=5, yticklabels=5,\n",
    "                linewidths=.5, cbar_kws={\"shrink\": .5}, ax=ax)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
